package com.kylin.common.weixin.miniapp.domain;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 退款参数
 * @author wuhao
 * @version 1.0 - 2023/4/10
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RefundParams {

    /** 商品名称 */
    private String body;
    /** 退款单号 */
    private String outRefundNo;
    /** 订单编号 */
    private String outTradeNo;
    /** 终端IP */
//    private String spbillCreateIp;
    /** 云托管环境变量 */
    private String envId;
    /** 子商户ID */
    private String subMchId;
    /** 总费用 */
    private long totalFee;
    /** 退款费用 */
    private long refundFee;
    /** 退款描述 */
    private String refundDesc;
    /** 结果通知类型 */
    private int callbackType;
    /** 服务名 */
    private String service;
    /** 业务路径 */
    private String path;

    public JSONObject toJson() {
        JSONObject json = new JSONObject();
        json.put("body",this.body);
        json.put("out_trade_no",this.outTradeNo);
        json.put("out_refund_no",this.outRefundNo);
//        json.put("spbill_create_ip",this.spbillCreateIp);
        json.put("env_id", this.envId);
        json.put("sub_mch_id",this.subMchId);
        json.put("total_fee",this.totalFee);
        json.put("refund_fee",this.refundFee);
        json.put("refund_desc",this.refundDesc);
        json.put("callback_type", 2);

        JSONObject container = new JSONObject();
        container.put("service",this.service);
        container.put("path", this.path);
        json.put("container", container);
        return json;
    }
}
